import { Observable } from 'rxjs'

import {
  IStoreQueryParams,
  IStorePagination,
  StoreFull,
  StoreUpdate,
  StoreCreate,
  StoreSettlementUpdate,
  StoreRiskControlUpdate,
  StoreCardFeatureUpdate,
  StoreQRFeatureUpdate,
  ICardRouteOfStore,
  IStoreReportPagination,
  IQRRouteOfStore,
  IECRouteOfStore,
} from '@shared/interfaces/store'
import { QrChannel, ExchangeRate, ICardChannel, IECUPIChannel } from '@shared/interfaces/acquirer'
import { UserRole } from '@shared/interfaces/user'
import { IGeneralResponse } from '@shared/interfaces/response'

export abstract class StoreService {
  abstract getList(params: IStoreQueryParams): Observable<IStorePagination>

  abstract getOne(intStoreCode: string): Observable<StoreFull>

  abstract create(store: StoreCreate): Observable<StoreFull>

  abstract update(intStoreCode: string, token: string, store: StoreUpdate): Observable<IGeneralResponse | StoreFull>

  abstract updateSettlement(
    intStoreCode: string,
    token: string,
    settlement: StoreSettlementUpdate,
  ): Observable<IGeneralResponse | StoreFull>

  abstract updateRiskControl(
    intStoreCode: string,
    token: string,
    riskControl: StoreRiskControlUpdate,
  ): Observable<IGeneralResponse | StoreFull>

  abstract updateCardFeature(feature: StoreCardFeatureUpdate): Observable<StoreFull>

  abstract updateQRFeature(
    intStoreCode: string,
    token: string,
    feature: StoreQRFeatureUpdate,
  ): Observable<IGeneralResponse | StoreFull>

  abstract getAcquirerQRChannels(insCode: string): Observable<QrChannel[]>

  abstract getAcquirerCardChannels(insCode: string): Observable<ICardChannel[]>

  abstract getAcquirerECChannels(insCode: string): Observable<IECUPIChannel[]>

  abstract getQRRoute(intStoreCode: string, id: string): Observable<IQRRouteOfStore>

  abstract deleteQRRoute(intStoreCode: string, id: string): Observable<void>

  abstract updateQRRoute(intStoreCode: string, id: string, route: IQRRouteOfStore): Observable<IQRRouteOfStore>

  abstract createQRRoute(intStoreCode: string, route: IQRRouteOfStore): Observable<IQRRouteOfStore>

  abstract getCardRoute(intStoreCode: string, id: string): Observable<ICardRouteOfStore>

  abstract updateCardRoute(intStoreCode: string, id: string, route: ICardRouteOfStore): Observable<ICardRouteOfStore>

  abstract createCardRoute(intStoreCode: string, route: ICardRouteOfStore): Observable<ICardRouteOfStore>

  abstract deleteCardRoute(intStoreCode: string, id: string): Observable<void>

  abstract getECRoute(intStoreCode: string, id: string): Observable<IECRouteOfStore>

  abstract updateECRoute(intStoreCode: string, id: string, route: IECRouteOfStore): Observable<IECRouteOfStore>

  abstract createECRoute(intStoreCode: string, route: IECRouteOfStore): Observable<IECRouteOfStore>

  abstract deleteECRoute(intStoreCode: string, id: string): Observable<void>

  abstract getStoreRoles(insCode: string): Observable<UserRole[]>

  abstract getAcquirerExchangeRates(insCode: string): Observable<ExchangeRate[]>

  abstract getStoreReport(params: IStoreQueryParams, str?: string): Observable<IStoreReportPagination>

  abstract freeze(intStoreCode: string): Observable<boolean>

  abstract unfreeze(intStoreCode: string): Observable<boolean>

  abstract submit(token: string): Observable<IGeneralResponse>

  /** 获取机构是否开通双信息 */
  abstract getAcquirerDualMessageSwitch(insCode: string): Observable<boolean>
}
